let cu_id = GetQueryString('cu_id');
$(function(){
    platform();
    info();

    $('#del').click(function(){
        layFirm('删除','admin/CurrencyDel',{cu_id:cu_id});
    })

});
function platform(){
    let data = AjaxForm('admin/CurrencyList');
    let html = '<option value="0">添加平台</option>';
    for (let i=0;i<data.length;i++){
        html += `<option value="${data[i].cu_id}" >${data[i].title}</option>`;
    }
    $('#pid').html(html);
}

function info(){

    let data = AjaxForm('admin/CurrencyDetail','get',{cu_id:cu_id});
    let option =$('#pid').children();
    for (let i=0;i<option.length;i++){
        if($(option[i]).val() == data.pid){
            $(option[i]).attr('selected',"selected")
        }
    }
    let show = $('#show').children();
    if(data.show == 1){
        $(show[0]).attr('selected',"selected");
    }else{
        $(show[1]).attr('selected',"selected");
    }
    $('input[name="title"]').val(data.title)
    $('input[name="cu_id"]').val(data.cu_id)
}
document.documentElement.style.overflow='hidden'